import { http } from "@/utils/http";
import { BaseResponse } from "@/model/BaseResponse";
import { DeliverInfo, DeliverQueryRequest } from "@/model/deliver";
import { Page } from "@/model/comon";

/** 分页查询获取全部授权信息*/
export const GetDeliverList = async (
  deliverQueryRequest: DeliverQueryRequest
) => {
  return await http.post<DeliverQueryRequest, BaseResponse<Page<DeliverInfo>>>(
    "/deliver/list/page",
    { data: deliverQueryRequest }
  );
};

/** 根据id删除授权信息*/
export const DeleteById = async (id: number) => {
  return await http.post<object, BaseResponse<boolean>>("/deliver/delete", {
    data: { id }
  });
};

/** 修改授权信息信息*/
export const UpdateDeliver = async (data: DeliverInfo) => {
  return await http.post<DeliverInfo, BaseResponse<boolean>>(
    "/deliver/update",
    {
      data
    }
  );
};

/** 新增授权信息 */
export const AddDeliver = async (deliver: DeliverInfo) => {
  return await http.post<DeliverInfo, BaseResponse<number>>("/deliver/add", {
    data: deliver
  });
};

// admin end
